import { getName } from '@/utils/cache';
import http from '@/utils/http';

export const getEventList = async (params) => {
  const resp = await http.get('/event/list', { params });
  return resp;
};

export const getFrameEventList = async (params) => {
  const resp = await http.get('/manager-frame/event/list', { params });
  return resp;
};

export const getEventDetail = async (params) => {
  const resp = await http.get('/event/detail', { params });
  return resp;
};

export const getEventLogs = async (params) => {
  const resp = await http.get('/event/logs', { params });
  return resp;
};

export const createEvent = async (data) => {
  const resp = await http.post('/event/create', data, {});
  return resp;
};

export const updateEvent = async (data) => {
  const resp = await http.post('/event/update', data);
  return resp;
};


export const updateAtta = async (data) => {
  const resp = await http.post('/attachment/update', data);
  return resp;
};

export const deleteEventById = async (id) => {
  const resp = await http.post('/event/delete', { id, oprator: getName() });
  return resp;
};

export default {
  getEventList,
  createEvent,
  updateEvent,
  deleteEventById,
};
